#include "widget.h"
#include "ui_widget.h"
#include "QMouseEvent"
#include "QDebug"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::mousePressEvent(QMouseEvent *event)
{
//    if(event->button()==Qt::LeftButton)
//    {
//        qDebug()<<"鼠标左键按下";
//    }
//    else if(event->button()==Qt::MidButton)
//    {
//        qDebug()<<"鼠标中间按下";
//    }
//    else if(event->button()==Qt::RightButton)
//    {
//        qDebug()<<"鼠标右键按下";
//    }

//    qDebug()<<event->x()<<","<<event->y();
//    qDebug()<<"鼠标按下";
}

void Widget::mouseReleaseEvent(QMouseEvent *event)
{
//    qDebug()<<event->x()<<","<<event->y();
//    qDebug()<<"鼠标已经释放";
}

void Widget::mouseDoubleClickEvent(QMouseEvent *event)
{
    qDebug()<<event->x()<<","<<event->y();
    qDebug()<<"鼠标双击";
}

